/**
 * 视频相关接口
 */
import request from '@/config/request'
import type { CvVideoProfileReqVO } from '@/types/profile'
import type { CvVideoMenuReqVO } from '@/types/menu'
import { CvVideoReqVO, CvVideoSaveReqVO, CvVideoUncollectedReqVO } from '@/types/video'

// ==================== 首页请求 ====================

/**
 * 获取视频热门内容推荐列表
 */
export const getVideoHotList = () => {
  return request.get({ url: '/platform/video/hotList' })
}

/**
 * 获取各类型视频热门推荐列表
 */
export const getAllVideoHotTypeList = () => {
  return request.get({ url: '/platform/video/allVideoHotTypeList' })
}

// ==================== 用户主页请求 ====================

/**
 * 获取用户主页视频列表
 */
export const getUserProfileVideoList = (reqVO: CvVideoProfileReqVO) => {
  return request.get({ url: '/platform/video/getUserProfileVideoList', params: reqVO })
}

// ==================== 视频页请求 ====================

export const getVideoDetail = (videoId: number | string) => {
  return request.get({ url: '/platform/video/detail', params: { videoId } })
}

export const getVideoRecommend = (videoId: number) => {
  return request.get({ url: '/platform/video/recommend', params: { videoId } })
}

// ==================== 筛选页请求 ====================

export const getVideoMenu = (reqVO: CvVideoMenuReqVO) => {
  return request.get({ url: '/platform/video/menu', params: reqVO })
}

// ==================== 视频合集 ====================

export const getUncollectedVideoPage = (reqVO: CvVideoUncollectedReqVO) => {
  return request.get({ url: '/platform/video/uncollected/page', params: reqVO })
}

export const getUncollectedVideoPageAndCurrent = (reqVO: CvVideoUncollectedReqVO) => {
  return request.get({ url: '/platform/video/uncollectedAndCurrent/page', params: reqVO })
}

// ==================== 视频保存请求 ====================

export const saveVideo = (reqVO: CvVideoSaveReqVO) => {
  return request.post({ url: '/platform/video/save', data: reqVO })
}

export const getVideoPage = (reqVO: CvVideoReqVO) => {
  return request.get({ url: '/platform/video/page', params: reqVO })
}

export const getVideoOperationDetail = (videoId: number) => {
  return request.get({ url: '/platform/video/operationDetail', params: { videoId } })
}

export const deleteVideo = (videoId: number) => {
  return request.delete({ url: '/platform/video/delete', params: { videoId } })
}
